from django.views.generic import View
from django.conf import settings
from libs import json_response, JsonParser, Argument
from libs.utils import human_time
from apps.order.models import Order
import json

notify_contacts = getattr(settings, 'Order_Contacts', 18001895750)


class OrderView(View):
    def post(self, request):
        form = json.loads(request.body)
        if not Order.objects.filter(source_id=form['source_id']).exists():
            Order.objects.create(**form)
        return json_response('ok')
